/*
 * Sgp4unit.h
 *
 *  Created on: 25/04/2012
 *      Author: ubuntu
 */

#ifndef SGP4UNIT_H_
#define SGP4UNIT_H_
#include "elsetrec.h"
#include "sgp4_math.h"    // for several misc routines
#include "sgp4_date.h"    // for several misc routines
#include "gravconsttype.h"
class Sgp4unit {
private:
elsetrec * satrec;


public:
	Sgp4unit();
	bool sgp4init
	     (
	       gravconsttype whichconst,  char opsmode
	     );

	bool sgp4
	     ( gravconsttype whichconst, double tsince,
	       double r[3],  double v[3]
	     );
	elsetrec* getSatrec();
private:
 void dpper
     (				double inclo,
    		        char init,
    		        double& ep,    double& inclp, double& nodep,  double& argpp, double& mp


     );

 void dscom
     (
      double epoch, double tc,double& snodm, double& cnodm, double& sinim,  double& cosim,
      double& sinomm,double& cosomm,double& day,   double& em,double& emsq,  double& gam,
      double& rtemsq,double& s1,    double& s2,    double& s3,     double& s4,  double& s5,
      double& s6,    double& s7,    double& ss1,    double& ss2,   double& ss3,
    		        double& ss4,   double& ss5,   double& ss6,    double& ss7,   double& sz1,
    		        double& sz2,   double& sz3,   double& sz11,   double& sz12,  double& sz13,
    		        double& sz21,  double& sz22,  double& sz23,   double& sz31,  double& sz32,
    		        double& sz33,  double& nm,    double& z1,     double& z2,    double& z3,
    		        double& z11,   double& z12,   double& z13,    double& z21,   double& z22,
    		        double& z23,   double& z31,   double& z32,    double& z33
     );

 void dsinit
     (
    		 gravconsttype whichconst,
    		        double cosim,  double emsq,   double s1,     double s2,
    		        double s3,     double s4,     double s5,      double sinim,  double ss1,
    		        double ss2,    double ss3,    double ss4,     double ss5,    double sz1,
    		        double sz3,    double sz11,   double sz13,    double sz21,   double sz23,
    		        double sz31,   double sz33,   double tc,      double xpidot, double z1,
    		        double z3,      double z11,    double z13,
    		        double z21,    double z23,    double z31,     double z33,    double eccsq,
    		        double& em,    double& argpm,  double& inclm, double& mm,
    		        double& nm,    double& nodem, double& dndt
     );

 void dspace
     (
    		 double tc,
    		     		        double& em,    double& argpm,  double& inclm,
    		     		        double& mm,    double& nodem,  double& dndt,  double& nm
     );

 void initl
     (
       int satn,      gravconsttype whichconst,
       double epoch,double& ainv,
       double& ao,  double& con42, double& cosio,
       double& cosio2,double& eccsq, double& omeosq, double& posq,
       double& rp,    double& rteosq,double& sinio
     );
};



#endif /* SGP4UNIT_H_ */
